#pragma once

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ----------------------------------------------------------------- */
#include "filter.h"
#include "stm32f4xx_hal.h"
/* Exported constants ------------------------------------------------------- */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */

typedef enum {
  PIT = 0,
  YAW = 1,
  ROL = 2,
} Axis_t;

typedef struct {
  struct {
    float q0;
    float q1;
    float q2;
    float q3;
  } quat;
  float samplefreq;
} AHRS_t;

typedef struct {
  struct {
    uint16_t x;
    uint16_t y;
    uint16_t z;
  } acc;
  struct {
    uint16_t x;
    uint16_t y;
    uint16_t z;
  } gyro;
} Raw_t;

typedef struct {
  struct {
    int16_t x;
    int16_t y;
    int16_t z;
  } acc;
  struct {
    int16_t x;
    int16_t y;
    int16_t z;
  } gyro;
} RawICM_t;

/* Exported functions prototypes -------------------------------------------- */

int8_t MahonyAHRS_Up(AHRS_t *ahrs, RawFloat_t *raw);
void IMU_Prase(AHRS_t *ahrs, Euler_t *angel, Euler_t *angel_2,
               Euler_t *angel_raw, RawFloat_t *raw);

#ifdef __cplusplus
}
#endif
